#列表的创建方式
#使用中括号“[]”创建列表
str1 = []
str2 = ['p','h','t','h','o','n']
str3 = [1,2.3,'a','&']

#使用list（）函数创建列表
list1 = list()
list2 = list('phthon')
list3 = list([1,'phthon'])


#访问列表元素
#使用索引访问列表元素
list4 = ["Java","#C","Phthon","PHP"]
print(list4[2])
print(list4[-1])


#使用切片访问列表元素
li = ["我","可","以","为","我","们","的","散","承","担","一","半"]
print(li[2:10])
print(li[:10])
print(li[2:])
print(li[:])
print(li[2:10:2])


#实例刮刮乐简略版
# happy = ["","一等奖","二等奖","三等奖","谢谢惠顾"]
# num = int(input("输入要刮的刮刮乐的位置（1~4）："))
# print(happy[num])


#列表的遍历
list5 = ["小楠","小李","小丘","小彭"]
print("学习通发来通知")
for i in list5:
    print(f"{i}学习通作业还有十分钟截止提交！！！")


#列表的排序
#sort()方法
li1 = [6,2,5,3]
li2 = [7,3,5,4]
li3 = ["其实","认真的雪","刚刚好","陪你去流浪"]
li1.sort()
li2.sort(reverse=True)
li3.sort(key=len)
print(li1)
print(li2)
print(li3)


#sorted()函数
li4 = [4,3,2,1]
li5 = sorted(li4)
print(li4)
print(li5)


#reerse（）方法
li6 = ["a","b","c","d"]
li6.reverse()
print(li6)


#商品价格区间排序





#添加元素方法
#append（）方法
li7 = [1,2,3,4]
li7.append(5)
print(li7)


#extend（）方法
li8 = ["a","b","c","d"]
li9 = [1,2,3]
li8.extend(li9)
print(li8)


#insert（）方法
list6 = ["我","以","为","规","则"]
list6.insert(3,"是")
print(list6)



#删除列表元素
#del语句
list7 = ["我","很","不","喜","欢","吃","菠","萝",]
del list7 [1]
print(list7)
del list7 [1:2]
print(list7)


#remove()方法
list8 = ["h","e","l","l","o"]
list8.remove("l")
print(list8)


#pop（）方法
list9 = ["我","不","喜","欢","她","姐"]
list9.pop()
print(list9)
list9.pop(1)
print(list9)


#修改列表元素
li10 = ["我","讨厌","吃","菠萝"]
li10[1] = "不喜欢"
print(li10)



#元组的创建方式
#使用圆括号“（）”创建元组
tu1 = ()
tu2 = (1,)
tu3 = ("p","h","t","h","o","n",)
tu3 = (0.3,1,"t","h","o","n",)


#使用tuple（）函数创建元组
tu4 = tuple()
print(tu4)
tu5 = tuple("abc")
print(tu5)
tu6 = tuple([1,2,3])
print(tu6)


#访问元组元素

























